﻿using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Activities.Validation;
using WFExtended.Activities;
using WFExtended.Tests.Model;
using System.Activities;
using WFExtended.Framework.ServiceModel;
using Microsoft.Activities.UnitTesting;
using System.Activities.Statements;

namespace WFExtended.Tests.Activities
{
    [TestClass]
    public class WcfConfigurationProxyTest : AWcfProxyActivityTest
    {
        [TestMethod]
        public void WcfConfigurationStringProxyWithoutInvokerValidationTest()
        {
            base.WcfStringProxyWithoutInvokerValidationTest<WcfConfigurationProxy<String>>();
        }

        [TestMethod]
        public void WcfConfigurationMockServiceProxyWithoutInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithoutInvokerValidationTest<WcfConfigurationProxy<IMockService>>();
        }

        [TestMethod]
        public void WcfConfigurationMockServiceProxyWithInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithInvokerValidationTest<WcfConfigurationProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        public void WcfConfigurationMockServiceProxyWithGenericInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithGenericInvokerValidationTest<WcfConfigurationProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        public void WcfConfigurationMockServiceNoPersistenceProxyValidationTest()
        {
            base.WcfMockServiceNoPersistenceProxyValidationTest<WcfConfigurationProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void WcfConfigurationMockServiceProxyWithoutNameExecutionTest()
        {
            var host = WorkflowInvokerTest.Create(new WcfConfigurationProxy<IMockService>());
            host.TestActivity();
        }

        [TestMethod]
        public void WcfConfigurationMockServiceProxyWithNameExecutionTest()
        {
            var host = WorkflowInvokerTest.Create(new WcfConfigurationProxy<IMockService>());
            host.InArguments.ConfigurationName = "mockEndpoint";
            host.TestActivity();
        }

    }
}
